<!-- 支付中心主体 -->
<h1>
    <{t}>购物车<{/t}><!--<{t}>结算中心<{/t}>-->
</h1>

<div id="payment_container" class="payment-container">
    <div class="cart-steps">
        <div class="step success"><{t}>我的购物车<{/t}></div>
        <div class="steps-separator"><span class="glyphicon glyphicon-arrow-right"></span></div>
        <div class="step success"><{t}>填写订单信息<{/t}></div>
        <div class="steps-separator"><span class="glyphicon glyphicon-arrow-right"></span></div>
        <div class="step active"><{t}>完成订单<{/t}></div>
        <div class="clearfix"></div>
    </div>
    <!--	<p><b><{t}>完成订单，请等待供应商确认库存！<{/t}></b></p>	-->

    <!-- 支付中心内容 -->
    <{if $newOrder == 'true'}>

    <p class="text-center">
        <span class="glyphicon glyphicon-ok order_suc"></span>
        <span class="msg-cont"><{t}>您的订单已经提交成功<{/t}><{if $order.payinfo.pay_app_id != '-1'}>,<{t}>请在供应商确认库存后付款<{/t}><{/if}>.</span>
    </p>

    <{/if}>
    <form action="<{$form_action}>" method="post" class="content" id="paycenter_form"<{if $order.payinfo.pay_app_id != 'deposit' || $combination_pay == 'true'}> target="_blank"<{/if}>>
    <div class="table-responsive">
        <table class="order-info table table-hover order_sucbox">
            <col class="col-1">
            <col class="col-2">
            <tbody>
            <tr>
                <td>
                    <{if $order.pre_order == 'false'}>
                    <span class="span-section"><{t}>订单号<{/t}><{t}>：<{/t}> <b><{$order.order_id}></b></span>
                    <{/if}>
                    <{if $order.pre_order == 'true'}>
                    <span class="span-section"><{t}>订单号<{/t}><{t}>：<{/t}> <b><{$order.order_id}></b><{t}>（<{/t}><{t}>预售订单号<{/t}><{t}>：<{/t}> <b><{$order.pre_number}></b><{t}>）<{/t}></span>
                    <{/if}>
                    <a href="<{link app=b2c ctl=site_member act=orderdetail arg0=$order.order_id}>" class="lnklike btn btn-xs btn-default" target="_blank"><{t}>查看详情<{/t}></a>
                </td>
            </tr>
            <!--<tr>
                <td><b>收货信息：</b><{$order.consignee.addr}>（<{t}>收货人<{/t}>：<{$order.consignee.name}> <{if $order.consignee.mobile}><{t}>手机<{/t}>：<{$order.consignee.mobile}><{/if}> <{if $order.consignee.telephone}> <{t}>固话:<{/t}><{$order.consignee.telephone}><{/if}> <{if $order.consignee.zip}><{t}>邮编<{/t}>：<{$order.consignee.zip}><{/if}>）<{$order.consignee.r_time}></td>
            </tr>-->
            <tr>
                <td>
                    <span class="span-section"><{t}>商品数量<{/t}><{t}>：<{/t}> <b><{$order.quantity}></b></span>


                    <!--预售信息的判断-->


                </td>
            </tr>
            <{if $order.pre_order == 'true'}>
            <tr>
                <td>
                 <span><{t}>预售商品最早到货日期<{/t}> <b><{$order.first_date}></b></span >
                 <span class='line-center'></span>
                 <span><b><{$order.last_date}></b></span>

                </td>
            </tr>
            <{/if}>


            <tr>
                <td>
                   <span class="item-price"><{t}>您需支付<{/t}><{t}>：<{/t}>
                        <span class="price update-current-amount">
                <!--&lt;!&ndash;预售信息的判断&ndash;&gt;-->
                <{if $order.promotion_type=='prepare' && $prepare.nowtime > $prepare.begin_time && $prepare.nowtime < $prepare.end_time  && $order.pay_status=='0' && $prepare.status=='true' && $prepare.promotion_price > $prepare.preparesell_price
                }>
                  <{$prepare.preparesell_price|cur:$order.currency}>
                <{/if}>

                <{if $order.promotion_type=='prepare' && $prepare.nowtime > $prepare.begin_time && $prepare.nowtime < $prepare.end_time  && $order.pay_status=='0' && $prepare.status=='true' && $prepare.promotion_price == $prepare.preparesell_price
                }>
                   <{$order.cur_money|cur:$order.currency}>
                <{/if}>

                <{if $order.promotion_type=='prepare' && $prepare.nowtime > $prepare.begin_time && $prepare.nowtime < $prepare.begin_time_final && $order.pay_status=='3'
                && $prepare.status=='true'
                }>
                  <{t}>尾款支付时间还未开始，敬请等待！<{/t}>
                <{/if}>

                <{if $order.promotion_type=='prepare' && $prepare.nowtime > $prepare.end_time && $prepare.nowtime < $prepare.begin_time_final && $order.pay_status=='0'
                && $prepare.status=='true'
                }>
                  <{t}>订金支付时间已过,无法支付！<{/t}>
                <{/if}>

                <{if $order.promotion_type=='prepare' && $prepare.nowtime > $prepare.end_time_final && ($order.pay_status=='3' || $order.pay_status=='0')
                && $prepare.status=='true'
                }>
                  <{t}>尾款支付时间已过！<{/t}>
                <{/if}>

                 <{if $order.promotion_type=='prepare' && $prepare.nowtime > $prepare.begin_time_final && $prepare.nowtime < $prepare.end_time_final && $prepare.status=='true'
                }>
                  <{$order.total_amount-$prepare.preparesell_price|cur:$order.currency}>
                <{/if}>


                <{if $order.promotion_type!='prepare'}>
                  <{$order.cur_money|cur:$order.currency}>
                <{/if}>
                        </span>
                   </span>
                </td>
            </tr>

            <!--==========================================================关于支付方式注释掉================================================-->
            <!--     <tr>
                     <td>
                         <div id="payment_center" class="payment-center">
                             <div class="payment-info">
                                 <input type="hidden" name="payment[order_id]" value="<{$order.order_id}>">
                                 &lt;!&ndash; <input type="hidden" name="shipping[shipping_id]" value="<{$order.shipping.shipping_id}>"> &ndash;&gt;
                                 <input type="hidden" name="payment[def_pay][cur_money]" value="<{$order.cur_money}>">
                                 <input type="hidden" name="payment[def_pay][pay_app_id]" value="<{$order.payinfo.pay_app_id}>">
                                 <input type="hidden" name="payment[memo]" value="<{$order.memo}>">
                                 <ul>
                                     <li >

                                         <i><{t}>已选择支付方式<{/t}><{t}>：<{/t}></i>


                                         <b class="mar-r-30"><{if $order.payinfo.pay_name}><{$order.payinfo.pay_name}><{else}><{$order.payinfo.pay_app_id|payname}><{/if}></b>
                                         <{if $order.payinfo.pay_app_id != '-1'}>
                                         <{if $order.payinfo.platform !='iscommon' && $order.payinfo.platform !='ispc'}>
                                         <{t}>（不支持此支付方式）<{/t}>
                                         <{/if}>
                                         <a href="javascript:void(0);" class="lnklike action-choose-payment btn btn-xs btn-default"><{t}>选择其它支付方式<{/t}> »</a>
                                         <{/if}>

                                         <{if $order.payinfo.pay_app_id=='deposit' && $order.promotion_type!='prepare'}>
                                         <{if $combination_pay == 'true' && $deposit_money - $order.cur_money < 0}>
                                         <input type="hidden" name="payment[combination_pay]" value="true">
                                         <span class="form-act"><{t}>预存款余额<{/t}><{t}>：<{/t}><b class="unavailable"><{$deposit_money|cur_odr:$order.currency}></b> <em>(<{t}>预存款余额不足，您可以<{/t}><a href="<{link app=b2c ctl=site_member act=deposit}>" target="_blank" class="lnklike action-recharge"><{t}>为预存款充值<{/t}></a>)</em></span>
                     <span class="form-act">
                       <input type="checkbox" name="payment[def_pay][cur_money]" value="<{$deposit_money}>" id="" class="action-other-payment">
                       <input type="hidden" name="payment[other_online][cur_money]" value="<{$order.cur_money - $deposit_money}>">
                       <{if !($deposit_money-0) }>
                       <{t}>当前无可用的预存款<{/t}>
                       <{else}>
                       <{t}>用预存款余额支付<{/t}> <b class="price"><{$deposit_money|cur_odr:$order.currency}></b>
                       <{/if}>
                       ,<{t}>选择其他支付方式支付剩余金额<{/t}> <b class="price update-remain-amount"><{$order.cur_money - $deposit_money|cur_odr:$order.currency}></b>
                     </span>
                                         <{else}>
                                         <input type="hidden" name="payment[combination_pay]" value="false">
                                         <span class="form-act"><{t}>预存款余额<{/t}><{t}>：<{/t}><b class="price"><{$deposit_money|cur_odr:$order.currency}></b> <{if $deposit_money-$order.total_amount < 0}> <em><{t}>您需要为<{/t}><a href="<{link app=b2c ctl=site_member act=deposit}>" target="_blank" class="lnklike action-recharge"><{t}>预存款充值<{/t}></a>,<{t}>充值完成后请<{/t}><a href="<{link app=b2c ctl=site_paycenter arg0=$order.order_id}>" class="lnklike"><{t}>刷新此页面<{/t}></a></em><{/if}></span>
                                         <{/if}>
                                         <{/if}>

                                         <{if $order.payinfo.pay_app_id=='deposit' && $order.promotion_type=='prepare' && $prepare.nowtime > $prepare.begin_time_final && $prepare.nowtime < $prepare.end_time_final }>
                                         <{if $combination_pay == 'true' && $deposit_money - $prepare.preparesell_price < 0}>
                                         <input type="hidden" name="payment[combination_pay]" value="true">
                                         <span class="form-act"><{t}>预存款余额<{/t}><{t}>：<{/t}><b class="unavailable"><{$deposit_money|cur_odr:$order.currency}></b> <em>(<{t}>预存款余额不足，您可以<{/t}><a href="<{link app=b2c ctl=site_member act=deposit}>" target="_blank" class="lnklike action-recharge"><{t}>为预存款充值<{/t}></a>)</em></span>
                     <span class="form-act">
                       <input type="checkbox" name="payment[def_pay][cur_money]" value="<{$deposit_money}>" id="" class="action-other-payment">
                       <input type="hidden" name="payment[other_online][cur_money]" value="<{$order.cur_money - $deposit_money}>">
                       <{if !($deposit_money-0) }>
                       <{t}>当前无可用的预存款<{/t}>
                       <{else}>
                       <{t}>用预存款余额支付<{/t}> <b class="price"><{$deposit_money|cur_odr:$order.currency}></b>
                       <{/if}>
                       ,<{t}>选择其他支付方式支付剩余金额<{/t}> <b class="price update-remain-amount"><{$order.cur_money - $deposit_money|cur_odr:$order.currency}></b>
                     </span>
                                         <{else}>
                                         <input type="hidden" name="payment[combination_pay]" value="false">
                                         <span class="form-act"><{t}>预存款余额<{/t}><{t}>：<{/t}><b class="price"><{$deposit_money|cur_odr:$order.currency}></b> <{if $deposit_money-$prepare.preparesell_price < 0}> <em><{t}>您需要为<{/t}><a href="<{link app=b2c ctl=site_member act=deposit}>" target="_blank" class="lnklike action-recharge"><{t}>预存款充值<{/t}></a>,<{t}>充值完成后请<{/t}><a href="<{link app=b2c ctl=site_paycenter arg0=$order.order_id}>" class="lnklike"><{t}>刷新此页面<{/t}></a></em><{/if}></span>
                                         <{/if}>
                                         <{/if}>

                                         <{if $order.payinfo.pay_app_id=='deposit' && $order.promotion_type=='prepare' && $prepare.nowtime > $prepare.begin_time && $prepare.nowtime < $prepare.end_time }>
                                         <{if $combination_pay == 'true' && $deposit_money - ($order.total_amount-$prepare.preparesell_price) < 0}>
                                         <input type="hidden" name="payment[combination_pay]" value="true">
                                         <span class="form-act"><{t}>预存款余额<{/t}><{t}>：<{/t}><b class="unavailable"><{$deposit_money|cur_odr:$order.currency}></b> <em>(<{t}>预存款余额不足，您可以<{/t}><a href="<{link app=b2c ctl=site_member act=deposit}>" target="_blank" class="lnklike action-recharge"><{t}>为预存款充值<{/t}></a>)</em></span>
                     <span class="form-act">
                       <input type="checkbox" name="payment[def_pay][cur_money]" value="<{$deposit_money}>" id="" class="action-other-payment">
                       <input type="hidden" name="payment[other_online][cur_money]" value="<{$order.cur_money - $deposit_money}>">
                       <{if !($deposit_money-0) }>
                       <{t}>当前无可用的预存款<{/t}>
                       <{else}>
                       <{t}>用预存款余额支付<{/t}> <b class="price"><{$deposit_money|cur_odr:$order.currency}></b>
                       <{/if}>
                       ,<{t}>选择其他支付方式支付剩余金额<{/t}> <b class="price update-remain-amount"><{$order.cur_money - $deposit_money|cur_odr:$order.currency}></b>
                     </span>
                                         <{else}>
                                         <input type="hidden" name="payment[combination_pay]" value="false">
                                         <span class="form-act"><{t}>预存款余额<{/t}><{t}>：<{/t}><b class="price"><{$deposit_money|cur_odr:$order.currency}></b> <{if $deposit_money-($order.total_amount-$prepare.preparesell_price) < 0}> <em><{t}>您需要为<{/t}><a href="<{link app=b2c ctl=site_member act=deposit}>" target="_blank" class="lnklike action-recharge"><{t}>预存款充值<{/t}></a>,<{t}>充值完成后请<{/t}><a href="<{link app=b2c ctl=site_paycenter arg0=$order.order_id}>" class="lnklike"><{t}>刷新此页面<{/t}></a></em><{/if}></span>
                                         <{/if}>
                                         <{/if}>

                                     </li>
                                     <{if $support_bank}>
                                     <{include file='site/paycenter/check_bank.html'}>
                                     <{/if}>
                                     &lt;!&ndash; 非货到付款或线下支付显示去付款 &ndash;&gt;
                                     <{if $order.promotion_type!='prepare'}>
                                     <{if !($order.payinfo.pay_app_id == '-1' || $order.payinfo.pay_app_id == 'offline') && $order.c_status=='2'}>
                                     <li class="form-item">
                       <span class="form-act">
                       <{if $order.payinfo.pay_app_id == 'deposit' && ($order.payinfo.platform =='iscommon' || $order.payinfo.platform =='ispc') }>
                         <{if $deposit_money > 0}>
                           <{button type="submit" class="btn-import btn-big action-prepaid" label=$___b2c="去付款"|t:'b2c'}>
                         <{/if}>
                       <{else}>
                         <{if $order.payinfo.platform =='iscommon' || $order.payinfo.platform =='ispc'}>
                         <{button type="submit" class="btn-import btn-big action-pay" label=$___b2c="去付款"|t:'b2c'}>
                         <{/if}>
                       <{/if}>
                       </span>
                                     </li>
                                     <{/if}>
                                     &lt;!&ndash;预售信息判断&ndash;&gt;
                                     <{else}>

                                     <{if !($order.payinfo.pay_app_id == '-1' || $order.payinfo.pay_app_id == 'offline')}>
                                     <li class="form-item">
                       <span class="form-act">
                         &lt;!&ndash;预存款支付方式的&ndash;&gt;
                       <{if $order.payinfo.pay_app_id == 'deposit' && ($order.payinfo.platform =='iscommon' || $order.payinfo.platform =='ispc') }>


                           <{if $prepare.nowtime < $prepare.begin_time && $prepare.status=='true'}>
                             <{t}>活动还未开始!<{/t}>
                           <{/if}>

                           <{if $prepare.nowtime > $prepare.begin_time && $prepare.nowtime < $prepare.end_time  && $order.pay_status=='0' && $prepare.status=='true' && $prepare.preparesell_price - $deposit_money <= 0}>
                             <{button type="submit" class="btn-import btn-big action-prepaid" label=$___b2c="去付订金"|t:'b2c'}>
                           <{/if}>
                           <{if $prepare.nowtime < $prepare.begin_time_final  && $order.pay_status=='3' && $prepare.status=='true'}>
                             <{button type="submit" disabled="false" class="btn-import btn-big" label=$___b2c="等待支付尾款"|t:'b2c'}>
                           <{/if}>
                           <{if $prepare.nowtime > $prepare.begin_time_final && $prepare.nowtime < $prepare.end_time_final  && $order.pay_status=='3' && $prepare.status=='true' && $deposit_money - ($order.total_amount-$prepare.preparesell_price) >= 0}>
                             <{button type="submit"  class="btn-import btn-big" action-prepaid label=$___b2c="支付尾款"|t:'b2c'}>
                           <{/if}>
                           <{if $prepare.nowtime > $prepare.end_time_final && $prepare.status=='true'}>
                             <{button type="submit" disabled="false" class="btn-import btn-big" label=$___b2c="活动结束"|t:'b2c'}>
                           <{/if}>
                       &lt;!&ndash;别的支付方式的&ndash;&gt;
                       <{else}>
                         <{if $order.payinfo.platform =='iscommon' || $order.payinfo.platform =='ispc'}>
                           <{if $prepare.nowtime < $prepare.begin_time && $prepare.status=='true'}>
                             <{t}>活动还未开始!<{/t}>
                           <{/if}>
                           <{if $prepare.nowtime > $prepare.begin_time && $prepare.nowtime < $prepare.end_time  && $order.pay_status=='0' && $prepare.status=='true'}>
                             <{button type="submit" class="btn-import btn-big action-pay" label=$___b2c="去付订金"|t:'b2c'}>
                           <{/if}>

                           <{if $prepare.nowtime < $prepare.begin_time_final  && $order.pay_status=='3' && $prepare.status=='true'}>
                             <{button type="submit" disabled="false" class="btn-import btn-big" label=$___b2c="等待支付尾款"|t:'b2c'}>
                           <{/if}>
                           <{if $prepare.nowtime > $prepare.end_time_final && $prepare.status=='true'}>
                             <{button type="submit" disabled="false" class="btn-import btn-big" label=$___b2c="活动结束"|t:'b2c'}>
                           <{/if}>

                            <{if $prepare.nowtime > $prepare.begin_time_final && $prepare.nowtime < $prepare.end_time_final  && $order.pay_status=='3' && $prepare.status=='true'}>
                             <{button type="submit" class="btn-import btn-big" label=$___b2c="支付尾款"|t:'b2c' action-pay}>
                           <{/if}>

                         <{/if}>
                       <{/if}>
                       </span>
                                     </li>
                                     <{/if}>

                                     <{/if}>
                                 </ul>
                                 <{if $order.payinfo.pay_app_id=='deposit' && $deposit_money - $order.total_amount < 0}>
                                 <div id="payment_recharge" class="payment-recharge" style="display:none;">
                                     <p><{t}>请在新开的预存款充值页面进行充值，充值结束后请选择：<{/t}></p>
                                     <p><a href="javascript:location.reload();" class="btn btn-caution btn-primary"><{t}>充值成功<{/t}></a>　　<a href="javascript:location.reload();" class="btn btn-simple btn-default"><{t}>充值失败<{/t}></a></p>
                                 </div>
                                 <{if $combination_pay == 'true'}>
                                 <div class="popup-content" style="display:none;">
                                     <h4><{t}>为剩余选择支付方式：<{/t}></h4>
                                     <div class="change-payment">
                                         <table>
                                             <tbody>
                                             <{foreach from=$payments item=payment_row}>
                                             <{if $payment_row.app_pay_type == 'true' && $payment_row.app_id != 'deposit'}>
                                             <tr>
                                                 <th>
                                                     <input type="radio" name="payment[other_online][pay_app_id]" id="" value="<{$payment_row.app_id}>" class="action-change-payment-online" vtype="requiredcustom" data-validatemsg="<{t}>请选择一种支付方式<{/t}>">
                                                     <label for=""><{$payment_row.app_name}></label>
                                                 </th>
                                                 <td><{$payment_row.app_pay_brief}></td>
                                             </tr>
                                             <{/if}>
                                             <{/foreach}>
                                             </tbody>
                                             <tfoot>
                                             <tr>
                                                 <td colspan="2">
                                                     <{if $order.payinfo.platform =='iscommon' || $order.payinfo.platform =='ispc'}>
                                                     <{button type="submit" class="btn-import btn-big action-combine-pay" label="去付款"}>
                                                     <{/if}>
                                                 </td>
                                             </tr>
                                             </tfoot>
                                         </table>
                                     </div>
                                 </div>
                                 <{/if}>
                                 <{/if}>
                                 <{if $order.payinfo.pay_des && $order.payinfo.pay_des != '&nbsp;'}>
                                 <div class="payment-tips">
                                     <h3><{t}>温馨提示：<{/t}></h3>
                                     <p><{$order.payinfo.pay_des}></p>
                                 </div>
                                 <{/if}>
                             </div>
                         </div>
                     </td>
                 </tr>-->
            <!--==========================================================关于支付方式注释掉   end================================================-->
            <tr>
                <td>
                    <span class="mar-r-10"><{t}>您还可以<{/t}><{t}>：<{/t}> <a href="<{link app=b2c ctl=site_member act=orders}> " class="lnklike btn btn-xs btn-default" target="_blank"><{t}>查看我的订单<{/t}></a> </span>
                    <span> или&nbsp;&nbsp;&nbsp;<a  href="./" class="btn btn-primary btn-xs" target="_blank"><{t}>继续购物<{/t}></a></span><div class="clearfix"></div>

                </td>
            </tr>
            </tbody>
        </table>

    </div>
    </form>

</div>

<div id="payment_online" class="payment-online" style="display:none;">
    <p><{t}>请在新开的支付平台页面进行付款，付款操作结束前请不要关闭页面，付款后选择<{/t}><{t}>：<{/t}></p>
    <div class="pay-stat">
        <div class="pay-success">
            <h4><{t}>支付成功<{/t}><{t}>：<{/t}></h4>
            <div class="action">
                <a href="<{link app=b2c ctl=site_member act=orderdetail arg0=$order.order_id}>" class="lnklike popup-btn-close"  target="_blank"><{t}>查看订单<{/t}></a>
            </div>
        </div>
        <div class="pay-failure">
            <h4><{t}>支付失败<{/t}><{t}>：<{/t}></h4>
            <div class="action">
                <a href="javascript:location.reload();" class="lnklike popup-btn-close"><{t}>重新支付<{/t}></a>
            </div>
        </div>
    </div>
</div>
<script>
    Object.merge(validatorMap, {
        requiredcustom: function(element, v, type, parent){
            var name = element.name;
            if(!parent.getElements('input[type=' + type + ']' + name ? '[name="' + name + '"]' : '').some(function(el) {
                        return el.checked == true && el.value != '0';
                    })) {
                showWarn(parent, element.get('data-validatemsg'));
                return false;
            }
            return true;
        }
    });

    function hideWarn(el) {
        el.retrieve('tips_instance', {hide: function(){}}).hide();
    }
    function showWarn(el, msg) {
        formTips.warn(msg, el);
        return false;
    }
    function pay_confirm (el, method) {
        if(method == 'online') {
            new Dialog($('payment_online').wrapped(),{
                modal:true,
                width:350,
                title: '<{t}>提醒<{/t}>',
                effect: false,
                component: {
                    container: 'alert-container',
                    body: 'alert-body',
                    header: 'alert-header',
                    close: 'alert-btn-close'
                },
                onClose: function(){
                    location.reload();
                }
            });
        }
        else {
            Dialog.confirm('<{t}>确定用你的预存款帐户支付这笔订单金额<{/t}><i class="price"><{if $order.promotion_type!='prepare'}><{$order.cur_money|cur:$order.currency}><{/if}><{if $order.promotion_type=='prepare' && $prepare.preparesell_price==$prepare.promotion_price}><{$order.cur_money|cur:$order.currency}><{/if}><{if $order.promotion_type=='prepare'&& $prepare.nowtime > $prepare.begin_time && $prepare.nowtime < $prepare.end_time && $prepare.preparesell_price<$prepare.promotion_price}><{$prepare.preparesell_price|cur:$order.currency}><{/if}><{if $order.promotion_type=='prepare' && $prepare.nowtime > $prepare.begin_time_final && $prepare.nowtime < $prepare.end_time_final && $prepare.preparesell_price<$prepare.promotion_price}><{$order.total_amount-$prepare.preparesell_price|cur:$order.currency}><{/if}></i>吗？', function(e){
                if(e){
                    el.getParent('form').submit();
                }
            });
        }
    }
    function loadPayment(data) {
        new Request({
            url: 'order-payment_change.html',
            onComplete: function (rs) {
                location.reload();
            }
        }).post(data.toQueryString() + '&order_id=<{$order.order_id}>');
    }

    $('paycenter_form').addEvent('submit', function(e){
        this.getElement('[type=submit]').disabled = true;
    });

    $(document.body).addEvents({
        'click:relay(.action-choose-payment)': function(e) {
            e.stop();
            var dialog = new Dialog('order-select_payment.html', {
                width: 800,
                title: '<{t}>修改支付方式<{/t}>',
                modal: true,
                async: 'ajax',
                asyncOptions: {
                    method: 'post',
                    data: 'shipping[shipping_id]=<{$order.shipping.shipping_id}>&payment[def_pay][pay_app_id]=<{$order.payinfo.pay_app_id}>&prepare[promotion_type]=<{$order.promotion_type}>',
                    onComplete: function() {
                        dialog.position();
                        $$('.popup-container')[0].setStyle('z-index', '10001');
                        $$('.mask')[0].setStyle('z-index', '10000');
                    }
                }
            });
        },
        // 预付款提示
        'click:relay(.action-prepaid)': function(e) {
            e.stop();
            if(this.disabled) return;
            pay_confirm(this, 'prepaid');
        },
        'click:relay(.action-pay)': function(e) {
            if(this.disabled) return;
            //e.stop();
            pay_confirm(this, 'online');
        },
        //= 组合支付
        'click:relay(.action-combine-pay)': function(e) {
            var parent = this.getParent('.change-payment');
            if(validate(parent, 'all')) {
                hideWarn(parent);
                pay_confirm(target, 'online');
            }
        },
        //= 确认支付方式
        'click:relay(.action-confirm-payment)': function(e) {
            var parent = this.getParent('.change-payment');
            if(validate(parent, 'all')) {
                hideWarn(parent);
                var update = $('payment_center');
                loadPayment(parent, update);
            }
        },
        'click:relay(.action-recharge)': function(e) {
            new Dialog($('payment_recharge').wrapped(), {
                width:400,
                modal:true
            });
        },
        //= 选择支付方式
        'change:relay(.action-change-payment)': function(e){
            var selected = this.getParent('tr').addClass('selected').getSiblings('tr.selected')[0];
            selected && selected.removeClass('selected');
        },
        'change:relay(.action-other-payment)': function(e) {
            this.getParent('.payment-info').getElement('.popup-content').setStyle('display', this.checked ? '' : 'none');
        },
        'change:relay(.action-change-payment-online)':function(e){
            new Request({
                url: '<{link app=b2c ctl=site_paycenter act=get_payment_money}>',
                onComplete: function (rs) {
                    rs = JSON.decode(rs);
                    $$('.update-current-amount').set('text', rs.total_amount);
                    $$('.update-remain-amount').set('text', rs.cur_money);
                }
            }).post($('payment_center'));
        }
    });
</script>
